//
//  WSOrderDetailCell.m
//  FD
//
//  Created by xiaofang wang on 2019/1/9.
//  Copyright © 2019年 ZhiYuan Network. All rights reserved.
//

#import "WSOrderDetailCell.h"
#import "WSOrderCellModel.h"

@interface WSOrderDetailCell()
/**标题*/
@property (nonatomic, strong) UILabel *nameLb;
/**线*/
@property (nonatomic, strong) UIView *lightLineView;
@end

@implementation WSOrderDetailCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

#pragma mark - 一 init
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupUI];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
    }
    return self;
}

- (void)setupUI {
    [self.contentView addSubview:self.nameLb];
    [self.contentView addSubview:self.lightLineView];
}


- (void)setModel:(WSOrderCellModel *)model {
    _model = model;
    
//    model.name = @"测试分类1:xxxx\n测试分类2：xx1、xxxjfkdjfl借款方尽快代理费2\nTopxxx:sxxs";
    self.nameLb.text = model.name;
}


#pragma mark - layout
- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.nameLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).offset(8);
        make.left.equalTo(self.contentView.mas_left).offset(15);
        make.right.equalTo(self.contentView.mas_right).offset(-15);
    }];
    
    [self.lightLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameLb.mas_bottom);
        make.left.equalTo(self.contentView.mas_left).offset(15);
        make.right.equalTo(self.contentView.mas_right).offset(-15);
        make.height.mas_equalTo(1);
    }];
}

#pragma mark - getter
- (UILabel *)nameLb {
    if (!_nameLb) {
        _nameLb = [UILabel new];
//        _nameLb.backgroundColor = [UIColor redColor];
        _nameLb.numberOfLines = 0; // 自动换行
        _nameLb.textColor = kLightGrayTextColor;
        _nameLb.font = [UIFont systemFontOfSize:15.0];
    }
    return _nameLb;
}

//线
- (UIView *)lightLineView {
    if (!_lightLineView) {
        _lightLineView = [[UIView alloc] init];
        _lightLineView.backgroundColor = kMainLightGrayColor;
    }
    return _lightLineView;
}


@end
